package com.sunwayworld.basemodule.basedata.codes.resource.impl;

import com.sunwayworld.basemodule.basedata.codes.resource.LimsCodeResource;
import com.sunwayworld.basemodule.basedata.codes.service.LimsCodeService;
import com.sunwayworld.basemodule.basedata.codes.validator.LimsCodeInsertableValidator;
import com.sunwayworld.framework.log.annotation.Log;
import com.sunwayworld.framework.log.annotation.LogModule;
import com.sunwayworld.framework.log.annotation.LogType;
import com.sunwayworld.framework.restful.data.RestJsonWrapperBean;
import com.sunwayworld.framework.spring.annotation.GikamBean;
import com.sunwayworld.framework.validator.data.annotation.ValidateDataWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

@LogModule("系统编码")
@RestController
@GikamBean
public class LimsCodeResourceImpl implements LimsCodeResource {

    @Autowired
    private LimsCodeService codeService;

    public LimsCodeResourceImpl() {
    }

    public LimsCodeService getService() {
        return codeService;
    }

    @Log(value = "新增", type = LogType.INSERT)
    @ResponseStatus(HttpStatus.OK)
    @ValidateDataWith(LimsCodeInsertableValidator.class)
    public Long insert(RestJsonWrapperBean jsonWrapper) {
        return this.getService().insert(jsonWrapper);
    }

    @Override
    public String addCategory(RestJsonWrapperBean wrapper) {
        return getService().addCategory(wrapper);
    }

    @Override
    public String deleteCategory(RestJsonWrapperBean wrapper) {
        return getService().deleteCategory(wrapper);
    }
}
